package com.somsoft.bzfk.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBOpenHelper extends SQLiteOpenHelper {

	private String createTableSql = "create table t_level(level integer)";
	
	public DBOpenHelper(Context context) {
		super(context, "block.db", null, 1);//数据库版本号改变，将会执行onUpgrade方法
	}

	@Override
	public void onCreate(SQLiteDatabase db) {//第一次使用时执行的方法
		db.execSQL(createTableSql);
		db.execSQL("insert into t_level(level) values(?) ",new Object[]{1});
		Log.i("创建数据库=====", "创建数据库=====");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//		db.execSQL("alter table person add amount int(10)");
		Log.i("更新数据库=====", "更新数据库=====");
	}

}